home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
p_man
/
cat3
/
Xm
/
XmPrintToFile.z
/
XmPrintToFile
Wrap
Text File
|
1998-10-30
|
7KB
|
133 lines
XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeee((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeee((((3333XXXX))))
NNNNAAAAMMMMEEEE
XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeee - Retrieves and saves data that would normally
be printed by the X Print Server.
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
#include <Xm/Print.h>
XXXXttttEEEEnnnnuuuummmmXXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeee(
DDDDiiiissssppppllllaaaayyyy****ddddppppyyyy,
SSSSttttrrrriiiinnnnggggffffiiiilllleeeennnnaaaammmmeeee,
XXXXPPPPFFFFiiiinnnniiiisssshhhhPPPPrrrrooooccccffffiiiinnnniiiisssshhhh____pppprrrroooocccc,
XXXXttttPPPPooooiiiinnnntttteeeerrrrcccclllliiiieeeennnntttt____ddddaaaattttaaaa);
VVVVEEEERRRRSSSSIIIIOOOONNNN
This page documents Motif 2.1.
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeeehides the details of X display connection and
XXXXppppGGGGeeeettttDDDDooooccccuuuummmmeeeennnnttttDDDDaaaattttaaaato the Motif application programmer.
This function is a convenience routine that hides the
details of the X and Xp internals to the application
programmer by calling the XXXXppppGGGGeeeettttDDDDooooccccuuuummmmeeeennnnttttDDDDaaaattttaaaafunction with
appropriate save and finish callbacks.
This is used in the context of X Printing when the user has
specified the "print-to-file" option from a regular Print
Setup Dialog box.
XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeeefirst tries to open the given filename for
writing and returns FFFFaaaallllsssseeeeif it can't. Else, it uses
XXXXppppGGGGeeeettttDDDDooooccccuuuummmmeeeennnnttttDDDDaaaattttaaaa, giving it a save proc that writes the
data received in the file and a finish proc that closes the
file or removes it on an unsuccessful termination. It calls
ffffiiiinnnniiiisssshhhh____pppprrrrooooccccat that point, passing it the argument received
from the Xp layer (ssssttttaaaattttuuuussss ======== XXXXPPPPGGGGeeeettttDDDDooooccccFFFFiiiinnnniiiisssshhhheeeeddddmeans the file
is valid and was closed, otherwise the file was removed).
XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeee is non-blocking; if it returns successfully,
it just means the file was opened successfully, not that all
the data was received.
_d_p_y Print display connection.
_f_i_l_e_n_a_m_e Name of the file to put the print data in.
_f_i_n_i_s_h__p_r_o_c
Called when all the data has been received.
_c_l_i_e_n_t__d_a_t_a
Passed with the _f_i_n_i_s_h__p_r_o_c.
RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
PPPPaaaaggggeeee 1111 ((((pppprrrriiiinnnntttteeeedddd 11110000////22224444////99998888))))
XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeee((((3333XXXX)))) UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV XXXXmmmmPPPPrrrriiiinnnnttttTTTTooooFFFFiiiilllleeee((((3333XXXX))))
Returns FFFFaaaallllsssseeeeif the filename could not be created or opened
for writing, TTTTrrrruuuueeee otherwise.
EEEERRRRRRRROOOORRRRSSSS////WWWWAAAARRRRNNNNIIIINNNNGGGGSSSS
Not applicable
EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS
A typical OK callback from a DDDDttttPPPPrrrriiiinnnnttttSSSSeeeettttuuuuppppBBBBooooxxxx:
PrintOKCallback(widget...)
/*-------------*/
{ int save_data = XPSpool;
pshell = XmPrintSetup (widget, pbs->print_screen,
"Print", NULL, 0);
XtAddCallback(pshell, XmNstartJobCallback, startJobCB, data);
if (pbs->destination == DtPRINT_TO_FILE)
save_data = XPGetData;
/* start job must precede XpGetDocumentData in XmPrintToFile */
XpStartJob(XtDisplay(pshell), save_data);
XFlush(XtDisplay(pshell)); /* maintain the sequence
between startjob and getdocument */
/* setup print to file */
if (pbs->destination == DtPRINT_TO_FILE)
XmPrintToFile(XtDisplay(pshell),
pbs->dest_info, FinishPrintToFile, NULL);
}
}
static void
startJobCB(Widget, XtPointer call_data, XtPointer client_data)
{
print(p); /* rendering happens here */
XpEndJob(XtDisplay(p->print_shell));
/* clean up */
XtDestroyWidget(p->print_shell);
XtCloseDisplay(XtDisplay(p->print_shell));
}
SSSSEEEEEEEE AAAALLLLSSSSOOOO
XXXXmmmmPPPPrrrriiiinnnnttttSSSSeeeettttuuuupppp(3), XXXXmmmmPPPPrrrriiiinnnnttttSSSShhhheeeellllllll(3), XXXXmmmmRRRReeeeddddiiiissssppppllllaaaayyyyWWWWiiiiddddggggeeeetttt(3),
XXXXmmmmPPPPrrrriiiinnnnttttPPPPooooppppuuuuppppPPPPDDDDMMMM(3)
Page 2 (printed 10/24/98)